package com.itheima.homework3;

import javax.swing.text.html.HTMLDocument;
import java.util.ArrayList;
import java.util.Iterator;

public class Demo3 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("hehe");
        list.add("haha");
        list.add("heihei");
        list.add("gege");
        list.add("gaga");
        //获取迭代器
        Iterator<String> it = list.iterator();
        //遍历
        while (it.hasNext()){
            String s = it.next();
            System.out.println(s);
        }
    }
}
